import React from 'react'
import {Table } from 'antd';
function NewsPublish(props) {
  const columns = [
    {
      title: '新闻标题',
      dataIndex: 'title',
        render:(title,item)=>{
            return <a href={`#/news-manage/preview/${item.id}`}>{title}</a>
        }
    },
    {
      title: '作者',
      dataIndex: 'author',

    },
    {
      title: '新闻分类',
      dataIndex: 'categoryId',
    },
    {
      title: '操作',
      dataIndex: '',
      key: 'key',
      render: (item) =>
        <div>
          {props.button(item.id)}
        </div>

    },
  ];


  return (
    <div>
      <Table dataSource={props.data} columns={columns} pagination={{
        pageSize: 5,
      }} 
      rowKey={item=>item.id}
      />;

    </div>
  )
}
export default NewsPublish
